home *** CD-ROM | disk | FTP | other *** search
- package horst;
-
- import horst.parser.HTMLParser;
- import java.awt.AWTEvent;
- import java.awt.Color;
- import java.awt.Component;
- import java.awt.Container;
- import java.awt.Cursor;
- import java.awt.Dimension;
- import java.awt.Font;
- import java.awt.FontMetrics;
- import java.awt.Frame;
- import java.awt.Graphics;
- import java.awt.Graphics2D;
- import java.awt.Image;
- import java.awt.LayoutManager;
- import java.awt.Point;
- import java.awt.Rectangle;
- import java.awt.Shape;
- import java.awt.event.InputEvent;
- import java.awt.event.KeyEvent;
- import java.awt.event.MouseEvent;
- import java.awt.event.MouseMotionListener;
- import java.awt.geom.AffineTransform;
- import java.awt.image.ImageObserver;
- import java.awt.print.Book;
- import java.awt.print.PageFormat;
- import java.awt.print.Paper;
- import java.awt.print.Printable;
- import java.awt.print.PrinterException;
- import java.awt.print.PrinterJob;
- import java.io.File;
- import java.io.FileOutputStream;
- import java.io.IOException;
- import java.io.PrintWriter;
- import java.io.Reader;
- import java.net.URL;
- import java.net.URLConnection;
- import java.util.Date;
- import java.util.Enumeration;
- import java.util.EventObject;
- import javax.swing.JComponent;
- import javax.swing.JOptionPane;
- import javax.swing.JPanel;
- import javax.swing.JPopupMenu;
- import javax.swing.JScrollPane;
- import javax.swing.JViewport;
- import javax.swing.Scrollable;
-
- public class HTMLPane extends JPanel implements Scrollable, MouseMotionListener, Printable {
- protected BusyFlag m_busyflag = new BusyFlag();
- protected HTMLDocument m_document;
- protected HTMLParser m_parser = new HTMLParser();
- protected LayoutInfo m_layoutInfo = new LayoutInfo();
- protected View m_rootView;
- protected ViewFactory m_viewFactory = new ViewFactory();
- protected boolean m_bParsing = false;
- protected HTMLPaneProperties m_props = new HTMLPaneProperties();
- protected HTMLPanePreferences m_preferences = new HTMLPanePreferences();
- protected int m_lastLayoutWidth = -1;
- protected boolean m_bCreatingViews;
- protected boolean m_bLayoutInProgress;
- protected Thread m_parsingThread;
- protected ToolTip m_toolTip = new ToolTip(this, "horst");
- protected boolean m_bPrinting = false;
- private static PrintWriter pwOut;
- private static int indent;
-
- public HTMLPane() {
- ((Component)this).enableEvents(48L);
- ((JComponent)this).setBackground(Color.white);
- ((Container)this).setLayout((LayoutManager)null);
- }
-
- protected void addFloater(View v) {
- this.m_props.m_floaters.addElement(v);
- }
-
- public void addLinkListener(LinkListener l) {
- this.m_props.m_linkListeners.addElement(l);
- }
-
- public void addStatusListener(HTMLPaneStatusListener l) {
- this.m_props.m_statusListeners.addElement(l);
- }
-
- public void back() {
- URL u = this.m_props.m_history.back();
- if (u != null) {
- this.loadPage(u, false);
- }
-
- }
-
- protected boolean beginParsing(Reader r, URL baseURL) {
- this.m_props.m_floaters.removeAllElements();
- this.m_document = null;
- this.m_document = this.createDocument();
- if (this.m_props.m_bIsIFrame || this.m_props.m_bIsFrame) {
- this.m_document.m_bPrintTree = false;
- }
-
- this.m_parser.setCallback(this.m_document);
-
- try {
- this.m_parser.parse(r, baseURL);
- this.m_document.m_baseURL = baseURL;
- return true;
- } catch (IOException e) {
- System.out.println(((Throwable)e).getMessage());
- JOptionPane.showMessageDialog((Component)null, "IOException occurred while parsing!", "Error", 0);
- this.notifyStatusListeners(9, (Object)null);
- return false;
- }
- }
-
- protected boolean beginParsing(URLConnection con) {
- URL u = con.getURL();
- this.m_props.m_floaters.removeAllElements();
- this.m_document = null;
- this.m_document = this.createDocument();
- if (this.m_props.m_bIsIFrame || this.m_props.m_bIsFrame) {
- this.m_document.m_bPrintTree = false;
- }
-
- this.m_parser.setCallback(this.m_document);
-
- try {
- this.m_parser.parse(con);
- u = this.m_document.getURL();
- return true;
- } catch (IOException var3) {
- this.notifyStatusListeners(9, u);
- return false;
- }
- }
-
- public boolean canMoveBack() {
- return this.m_props.m_history.canMoveBack();
- }
-
- public boolean canMoveForward() {
- return this.m_props.m_history.canMoveForward();
- }
-
- public void cancelPrintJob() {
- if (this.m_props.m_printJob != null && !this.m_props.m_printJob.isCancelled()) {
- this.m_props.m_printJob.cancel();
- }
-
- }
-
- protected void clearFocusElement() {
- this.notifyMouseOverLink((URL)null);
- if (this.m_props.m_focusElement != null) {
- this.m_props.m_focusElement.propagateFocus(false);
- this.m_props.m_focusElement = null;
- ((Component)this).repaint();
- }
-
- }
-
- public static void closeLog() {
- if (pwOut != null) {
- pwOut.close();
- pwOut = null;
- }
-
- }
-
- protected HTMLDocument createDocument() {
- return new EditableHTMLDocument(this);
- }
-
- protected void createViews(Element root) {
- if (!this.m_bCreatingViews && !this.m_bLayoutInProgress) {
- this.m_bCreatingViews = true;
- ((Container)this).removeAll();
- this.m_lastLayoutWidth = -1;
- if (this.m_rootView != null) {
- this.m_rootView.flushResources();
- this.m_rootView = null;
- }
-
- if (this.m_props.m_rootElement != null) {
- this.m_props.m_rootElement.flushResources();
- this.m_props.m_rootElement = null;
- }
-
- System.gc();
- this.m_props.m_rootElement = root;
- this.m_rootView = this.m_viewFactory.createView((View)null, this.m_props.m_rootElement, this);
- if (this.m_rootView != null) {
- this.m_rootView.makeChildren(this.m_viewFactory);
- this.notifyStatusListeners(3, this.m_document.getURL());
- this.m_rootView.loadResources();
- this.notifyStatusListeners(9, this.m_document.getURL());
- }
-
- this.m_bCreatingViews = false;
- } else {
- System.out.println("createViews being called with m_bCreatingViews=" + this.m_bCreatingViews + " m_bLayoutInProgress=" + this.m_bLayoutInProgress);
- }
- }
-
- public View elementToView(Element e) {
- return this.m_rootView != null && e != null ? this.m_rootView.elementToView(e) : null;
- }
-
- public void enableDebugMessages(boolean bEnable) {
- Utilities.m_bDebugging = bEnable;
- }
-
- public void enableToolTips(boolean bEnable) {
- this.m_preferences.m_bShowToolTip = bEnable;
- }
-
- private int findFocusElement(Element[] anchors) {
- int idx = -1;
- int i = 0;
-
- for(i = 0; i < anchors.length; ++i) {
- Element elem = anchors[i];
- if (this.m_props.m_focusElement != null && this.m_props.m_focusElement.getType() == 50 && elem == this.m_props.m_focusElement || elem.m_relatedElements.size() > 0 && this.m_props.m_focusElement == elem.m_relatedElements.elementAt(0)) {
- break;
- }
- }
-
- if (i < anchors.length) {
- idx = i;
- }
-
- return idx;
- }
-
- int findText(String text, int lastPos) {
- int pos = -1;
- if (this.m_document != null && this.m_rootView != null) {
- StringBuffer buffer = this.m_document.getTextBuffer();
- String str = buffer.toString().toLowerCase();
- text = text.toLowerCase();
- int save = 0;
- if (lastPos >= 0) {
- save = lastPos + text.length();
- str = str.substring(save, str.length());
- }
-
- int idx = str.indexOf(text);
- if (idx != -1) {
- pos = save + idx;
- }
- }
-
- return pos;
- }
-
- protected ElementViewInfo floaterHitTest(int x, int y) {
- ElementViewInfo info = null;
- Enumeration e = this.m_props.m_floaters.elements();
-
- while(e.hasMoreElements()) {
- View v = (View)e.nextElement();
- info = v.viewToModel(x, y);
- if (info != null) {
- break;
- }
- }
-
- return info;
- }
-
- protected void forceLayout() {
- this.lock();
- JViewport vp = this.getViewport();
- if (vp != null) {
- this.m_lastLayoutWidth = -1;
-
- Component parent;
- for(parent = ((Component)this).getParent(); parent != null && !(parent instanceof JScrollPane); parent = parent.getParent()) {
- }
-
- if (parent != null) {
- ((Container)vp).invalidate();
- parent.validate();
- }
- } else {
- Component parent = ((Component)this).getParent();
- if (parent != null && parent.getSize().width > 0) {
- this.layoutViews(parent.getSize().width);
- }
- }
-
- this.unlock();
- }
-
- public void forward() {
- URL u = this.m_props.m_history.forward();
- if (u != null) {
- this.loadPage(u, false);
- }
-
- }
-
- protected Dimension getBrowserDimension() {
- Component parent = ((Component)this).getParent();
- return parent != null && parent instanceof JViewport ? ((JViewport)parent).getExtentSize() : new Dimension(700, 700);
- }
-
- public HTMLDocument getDocument() {
- return this.m_document;
- }
-
- protected View[] getFloaters() {
- View[] floats = new View[this.m_props.m_floaters.size()];
- this.m_props.m_floaters.copyInto(floats);
- return floats;
- }
-
- public boolean getFramesEnabled() {
- return this.m_preferences.m_bFramesEnabled;
- }
-
- protected HTMLWindow getHTMLWindow() {
- for(Component parent = ((Component)this).getParent(); parent != null; parent = parent.getParent()) {
- if (parent instanceof HTMLWindow) {
- return (HTMLWindow)parent;
- }
- }
-
- return null;
- }
-
- public boolean getIFramesEnabled() {
- return this.m_preferences.m_bIFramesEnabled;
- }
-
- protected ModelInfo getModelInfo(int x, int y) {
- ModelInfo info = new ModelInfo(this);
- if (this.m_rootView != null) {
- info.m_ev = this.floaterHitTest(x, y);
- if (info.m_ev == null) {
- info.m_ev = this.m_rootView.viewToModel(x, y);
- }
-
- if (info.m_ev != null && info.m_ev.m_view.isLink()) {
- String link = (String)info.m_ev.m_elem.getAttribute("href");
- if (link != null) {
- info.target = (String)info.m_ev.m_elem.getAttribute("target");
- if (info.target == null) {
- Element baseElem = this.m_document.getBaseElement();
- if (baseElem != null) {
- info.target = (String)baseElem.getAttribute("target");
- }
- }
-
- String ref = (String)this.m_rootView.getAttribute("href");
- URL refURL = null;
- if (ref != null) {
- refURL = Utilities.getURL(ref);
- }
-
- if (refURL != null) {
- info.url = Utilities.getURL(refURL, link);
- } else {
- info.url = Utilities.getURL(link);
- }
- }
- }
- }
-
- return info;
- }
-
- public int getNumPages(int pgWidth, int pgHeight) {
- int nPages = this.paginate(pgWidth, pgHeight);
- this.m_layoutInfo.bPaginate = false;
- this.forceLayout();
- return nPages;
- }
-
- public PageFormat getPageFormat() {
- return this.m_props.m_pageFormat;
- }
-
- public int getPageHeight() {
- return this.m_rootView != null ? this.m_rootView.getBounds().height : 0;
- }
-
- public Image getPageImage(int pgNum, int pgWidth, int pgHeight) {
- if (this.m_rootView == null) {
- return null;
- } else {
- Image img = null;
- this.paginate(pgWidth, pgHeight);
- Rectangle b = this.m_rootView.getBounds();
- Frame frame = Utilities.getFrame(this);
- Image offscreen = ((Component)frame).createImage(b.width, this.m_layoutInfo.pageHeight);
- Graphics og = offscreen.getGraphics();
- og.setColor(((Component)this).getBackground());
- og.fillRect(0, 0, offscreen.getWidth((ImageObserver)null), offscreen.getHeight((ImageObserver)null));
- og.setClip(0, 0, b.width, this.m_layoutInfo.pageHeight);
- int y = (pgNum - 1) * (this.m_layoutInfo.pageHeight + this.m_layoutInfo.pageBreakHeight);
- og.translate(0, -y);
- this.renderPage(og);
- this.m_layoutInfo.bPaginate = false;
- this.forceLayout();
- return offscreen;
- }
- }
-
- public int getPageWidth() {
- return this.m_rootView != null ? this.m_rootView.getBounds().width : 0;
- }
-
- protected int getPaneHeight() {
- JViewport jp = this.getViewport();
- return jp != null ? jp.getExtentSize().height : 800;
- }
-
- protected int getPaneWidth() {
- JViewport jp = this.getViewport();
- return jp != null ? jp.getExtentSize().width : 800;
- }
-
- public Dimension getPreferredScrollableViewportSize() {
- return this.m_rootView != null ? new Dimension(this.getPageWidth(), this.getPageHeight()) : new Dimension(2000, 2000);
- }
-
- public Dimension getPreferredSize() {
- this.lock();
- int portWidth = this.getPaneWidth();
- int portHeight = this.getPaneHeight();
- if (this.m_rootView == null && this.m_document != null) {
- Element root = this.m_document.getRootElement();
- if (root != null) {
- this.createViews(root);
- }
- }
-
- if (this.m_rootView == null) {
- this.unlock();
- return new Dimension(portWidth, portHeight);
- } else {
- if (this.m_lastLayoutWidth != portWidth) {
- this.layoutViews(portWidth);
- }
-
- Dimension d = new Dimension(this.m_rootView.getBounds().width, this.m_rootView.getBounds().height);
- this.unlock();
- return d;
- }
- }
-
- public int getPrintingLayoutWidth(int width) {
- return this.m_props.m_printingLayoutWidth;
- }
-
- public boolean getProgressiveDisplay() {
- return this.m_preferences.m_bProgressiveDisplay;
- }
-
- protected Element getRootElement() {
- return this.m_props.m_rootElement;
- }
-
- public int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction) {
- switch (orientation) {
- case 0:
- return visibleRect.width;
- case 1:
- return visibleRect.height;
- default:
- throw new IllegalArgumentException("Invalid orientation: " + orientation);
- }
- }
-
- public boolean getScrollableTracksViewportHeight() {
- return false;
- }
-
- public boolean getScrollableTracksViewportWidth() {
- return false;
- }
-
- public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction) {
- switch (orientation) {
- case 0:
- return visibleRect.width / 10;
- case 1:
- return visibleRect.height / 10;
- default:
- throw new IllegalArgumentException("Invalid orientation: " + orientation);
- }
- }
-
- public File getSourceFile(String path) {
- File f = null;
- if (this.m_props.m_loadedPage != null) {
- HTMLParser parser = new HTMLParser();
- f = parser.getSourceFile(this.m_props.m_loadedPage, path);
- }
-
- return f;
- }
-
- protected JViewport getViewport() {
- Component parent = ((Component)this).getParent();
- return parent != null && parent instanceof JViewport ? (JViewport)parent : null;
- }
-
- private void handleTabKey(KeyEvent e) {
- Element[] anchors = this.m_document.getAnchors();
- boolean bUp = (((InputEvent)e).getModifiers() & 1) != 0;
- int idx = this.findFocusElement(anchors);
- if (idx == -1) {
- if (!bUp && anchors.length > 0) {
- this.setAnchorFocus(anchors[0]);
- }
- } else if (bUp && idx > 0) {
- this.setAnchorFocus(anchors[idx - 1]);
- } else if (!bUp && idx < anchors.length - 1) {
- this.setAnchorFocus(anchors[idx + 1]);
- } else {
- this.clearFocusElement();
- }
-
- if (this.m_props.m_focusElement != null) {
- this.scrollToVisible(this.m_props.m_focusElement.m_p0);
- }
-
- ((InputEvent)e).consume();
- }
-
- protected void imageMapHitTest(MouseEvent evt, ModelInfo info) {
- if (info.m_ev.m_elem.getType() == 11 && (info.m_ev.m_elem.isAttributeDefined("ismap") || info.m_ev.m_elem.isAttributeDefined("usemap"))) {
- int x = evt.getX() - (info.m_ev.m_view.getBounds().x + info.m_ev.m_view.m_insets.left);
- int y = evt.getY() - (info.m_ev.m_view.getBounds().y + info.m_ev.m_view.m_insets.top);
- String mapName = (String)info.m_ev.m_elem.getAttribute("usemap");
- if (mapName != null && mapName.length() > 0) {
- while(mapName.charAt(0) == '#' && mapName.length() > 1) {
- mapName = mapName.substring(1);
- }
-
- Enumeration e1 = this.m_document.getMapElements();
-
- while(e1.hasMoreElements()) {
- Element mapElem = (Element)e1.nextElement();
- String name = (String)mapElem.getAttribute("name");
- if (name != null && name.equalsIgnoreCase(mapName)) {
- Enumeration e = mapElem.getChildren().elements();
-
- while(e.hasMoreElements()) {
- Element areaElem = (Element)e.nextElement();
- if (areaElem.getType() == 50 && areaElem.isAttributeDefined("href")) {
- String shapeName = (String)areaElem.getAttribute("shape");
- String coordinates = (String)areaElem.getAttribute("coords");
- if (coordinates != null) {
- Shape s = Utilities.createShape(shapeName, coordinates);
- if (s != null && s.getBounds().contains(x, y)) {
- URL u = Utilities.getURL(this.m_document.getBaseURL(), (String)areaElem.getAttribute("href"));
- if (u != null) {
- info.url = u;
- }
-
- info.target = (String)areaElem.getAttribute("target");
- return;
- }
- }
- }
- }
- break;
- }
- }
- } else {
- String href = (String)info.m_ev.m_elem.getAttribute("href");
- if (href != null) {
- String params = "?" + x + "," + y;
- URL u = Utilities.getURL(href + params);
- if (u != null) {
- info.url = u;
- }
- }
- }
- }
-
- }
-
- public boolean isPaginated() {
- return this.m_layoutInfo.bPaginate;
- }
-
- protected boolean isTextSelected() {
- return this.m_document != null ? this.m_document.isTextSelected() : false;
- }
-
- protected Rectangle layoutViews(int width) {
- Utilities.debugOut("layoutViews width=" + width + " url=" + this.m_props.m_loadedPage);
- if (this.m_rootView == null) {
- return new Rectangle(0, 0, 0, 0);
- } else if (this.m_bLayoutInProgress) {
- System.out.println("BUG HTMLPANE.layoutViews m_bLayoutInProgress recovering...");
- return new Rectangle(0, 0, 0, 0);
- } else if (this.m_bCreatingViews) {
- System.out.println("BUG HTMLPANE.layoutViews recovering...");
- return new Rectangle(0, 0, 0, 0);
- } else {
- this.m_bLayoutInProgress = true;
- this.notifyStatusListeners(2, this.m_props.m_loadedPage);
- this.m_layoutInfo.clear();
- this.m_props.m_floaters.removeAllElements();
- this.m_document.resetElements();
- this.m_rootView.reset();
- this.m_rootView.layout(0, 0, width, this.m_layoutInfo);
- this.m_rootView.setDimensions(this.getPaneWidth(), this.getPaneHeight());
- this.notifyStatusListeners(9, this.m_props.m_loadedPage);
- this.m_bLayoutInProgress = false;
- this.m_lastLayoutWidth = width;
- return this.m_rootView.getBounds();
- }
- }
-
- public void loadApplets(boolean bLoad) {
- this.m_preferences.m_bLoadApplets = bLoad;
- }
-
- protected void loadImageContent(URL u) {
- this.m_document = this.createDocument();
- this.m_props.m_rootElement = new Element(11);
- this.m_props.m_rootElement.setDocument(this.m_document);
- this.m_props.m_rootElement.setAttribute("src", u.toString());
- this.m_props.m_rootElement.setAttribute("imagecontent", "true");
- this.m_props.m_loadedPage = u;
- this.createViews(this.m_props.m_rootElement);
- this.forceLayout();
- this.notifyStatusListeners(5, this.m_props.m_loadedPage);
- }
-
- public void loadImages(boolean bLoad) {
- this.m_preferences.m_bLoadImages = bLoad;
- }
-
- protected synchronized void loadPage(Reader r, URL baseURL, boolean bAddToHistory) {
- this.m_toolTip.hide();
- this.m_bParsing = true;
- ((Component)this).setCursor(Cursor.getPredefinedCursor(3));
- this.m_parsingThread = new Thread(new ParsingThread(this, r, baseURL, bAddToHistory));
- this.m_parsingThread.start();
- }
-
- protected synchronized void loadPage(URL url, boolean bAddToHistory) {
- if (this.m_document != null) {
- String urlStr = url.toString();
- int idx = urlStr.indexOf("#");
- if (idx != -1) {
- String anchorName = urlStr.substring(idx + 1);
- urlStr = urlStr.substring(0, idx);
- URL newURL = Utilities.getURL(urlStr);
- if (this.m_props.m_loadedPage != null && this.m_props.m_loadedPage.equals(newURL)) {
- Element e = this.m_document.getAnchor(anchorName);
- if (e != null && e.m_p0 >= 0) {
- this.scrollToPosition(e.m_p0);
- return;
- }
- }
- }
- }
-
- this.m_toolTip.hide();
- this.m_bParsing = true;
- ((Component)this).setCursor(Cursor.getPredefinedCursor(3));
- this.m_parsingThread = new Thread(new ParsingThread(this, url, bAddToHistory));
- this.m_parsingThread.start();
- }
-
- void lock() {
- this.m_busyflag.getBusyFlag();
- }
-
- public void mouseDragged(MouseEvent e) {
- }
-
- public void mouseMoved(MouseEvent e) {
- Object src = ((EventObject)e).getSource();
- if (src instanceof Component) {
- Component c = (Component)src;
- e.translatePoint(c.getBounds().x, c.getBounds().y);
- this.processMouseMotionEvent(e);
- }
-
- }
-
- protected void notifyMouseOverLink(URL u) {
- String href = "";
- if (u != null) {
- href = u.toString();
- }
-
- Enumeration e = this.m_props.m_linkListeners.elements();
-
- while(e.hasMoreElements()) {
- LinkListener l = (LinkListener)e.nextElement();
- l.mouseOverLink(href);
- }
-
- }
-
- protected boolean notifyMousePressedOverLink(URL u) {
- String href = "";
- if (u != null) {
- href = u.toString();
- }
-
- Enumeration e = this.m_props.m_linkListeners.elements();
-
- while(e.hasMoreElements()) {
- LinkListener l = (LinkListener)e.nextElement();
- boolean bLoad = l.mousePressedOverLink(href);
- if (!bLoad) {
- return false;
- }
- }
-
- return true;
- }
-
- protected boolean notifyStatusListeners(int val, Object info) {
- boolean retVal = true;
- Enumeration e = this.m_props.m_statusListeners.elements();
-
- while(e.hasMoreElements()) {
- HTMLPaneStatusListener l = (HTMLPaneStatusListener)e.nextElement();
- HTMLPaneStatusEvent evt = new HTMLPaneStatusEvent(this, val, info);
- if (!l.statusChanged(evt)) {
- retVal = false;
- }
- }
-
- return retVal;
- }
-
- public void openPage(Reader r, URL baseURL) {
- if (r != null) {
- this.loadPage(r, baseURL, true);
- }
-
- }
-
- public void openPage(URL u) {
- if (u != null) {
- this.loadPage(u, true);
- }
-
- }
-
- public int paginate(int pgWidth, int pgHeight) {
- int nPages = 1;
- if (this.m_rootView != null) {
- this.notifyStatusListeners(2, this.m_props.m_loadedPage);
- this.m_layoutInfo.clear();
- this.m_layoutInfo.bPaginate = true;
- this.m_layoutInfo.pageHeight = pgHeight;
- this.m_layoutInfo.pageWidth = pgWidth;
- this.m_props.m_floaters.removeAllElements();
- this.m_document.resetElements();
- this.m_rootView.reset();
- Rectangle b = this.m_rootView.layout(0, 0, pgWidth, this.m_layoutInfo);
- int start = this.m_layoutInfo.pageHeight;
-
- for(int end = start + this.m_layoutInfo.pageBreakHeight; start < b.y + b.height; end = start + this.m_layoutInfo.pageBreakHeight) {
- ++nPages;
- start = end + this.m_layoutInfo.pageHeight;
- }
-
- ((Component)this).repaint();
- }
-
- return nPages;
- }
-
- public void paint(Graphics g) {
- Rectangle alloc = g.getClipRect();
- Dimension dim = ((Component)this).getSize();
- g.setColor(((Component)this).getBackground());
- g.fillRect(0, 0, dim.width, dim.height);
- if (this.m_rootView != null) {
- this.m_rootView.paint(g, alloc);
- Enumeration e = this.m_props.m_floaters.elements();
-
- while(e.hasMoreElements()) {
- View v = (View)e.nextElement();
- Rectangle r = v.getBounds();
- if (r != null) {
- v.paint(g, r);
- }
- }
-
- this.paintFocusBoxes(g, alloc);
- }
-
- ((JComponent)this).paintChildren(g);
- if (this.m_layoutInfo.bPaginate) {
- Rectangle b = this.m_rootView.getBounds();
- int start = this.m_layoutInfo.pageHeight;
- int end = start + this.m_layoutInfo.pageBreakHeight;
-
- for(int nPage = 1; start < b.y + b.height; end = start + this.m_layoutInfo.pageBreakHeight) {
- g.setColor(Color.blue);
- g.drawString("Y = " + start, 20, start);
- g.drawLine(0, start, 800, start);
- g.drawString("Y = " + end + " Page " + nPage++, 20, end);
- g.drawLine(0, end, 800, end);
- start = end + this.m_layoutInfo.pageHeight;
- }
-
- g.setColor(Color.blue);
- g.drawLine(this.m_layoutInfo.pageWidth, 0, this.m_layoutInfo.pageWidth, 2000);
- }
-
- }
-
- void paintFocusBoxes(Graphics g, Shape alloc) {
- this.m_rootView.paintFocusBox(g, alloc);
- Enumeration e = this.m_props.m_floaters.elements();
-
- while(e.hasMoreElements()) {
- View v = (View)e.nextElement();
- Rectangle r = v.getBounds();
- if (r != null) {
- v.paintFocusBox(g, r);
- }
- }
-
- Enumeration e = this.m_document.getAnchorsEnumeration();
-
- while(e.hasMoreElements()) {
- Element elem = (Element)e.nextElement();
- if (elem.getType() == 50 && elem.getDrawFocusBox()) {
- Element mapElem = this.m_document.getMapElement(elem);
- if (mapElem != null) {
- String mapName = (String)mapElem.getAttribute("name");
- if (mapName != null) {
- mapName = "#" + mapName;
- Element imgElem = this.m_document.findElement(11, "usemap", mapName);
- if (imgElem != null) {
- View vw = this.m_rootView.elementToView(imgElem);
- if (vw != null) {
- String shapeName = (String)elem.getAttribute("shape");
- String coordinates = (String)elem.getAttribute("coords");
- if (coordinates != null) {
- Shape s = Utilities.createShape(shapeName, coordinates);
- if (s != null) {
- Rectangle r = s.getBounds();
- r.x += vw.getBounds().x;
- r.y += vw.getBounds().y;
- Utilities.drawFocusBorder(g, r);
- }
- }
- }
- }
- }
- }
- }
- }
-
- }
-
- public int print(Graphics g, PageFormat pf, int pageIndex) throws PrinterException {
- return pageIndex >= this.m_props.m_printSpecs.m_nPages ? 1 : this.renderToPrinter(g, pf, pageIndex);
- }
-
- void printHeaderFooter(Graphics g, PageFormat pf, int pageIndex) {
- Font oldFont = g.getFont();
- g.setFont(this.m_props.m_printSpecs.m_font);
- FontMetrics fm = g.getFontMetrics();
- int textHeight = fm.getHeight();
- int width = (int)pf.getImageableWidth();
- int height = (int)pf.getImageableHeight();
- int x = (int)pf.getImageableX();
- int y = (int)pf.getImageableY();
- g.setColor(Color.black);
- if (this.m_props.m_printSpecs.m_url != null) {
- g.drawString(this.m_props.m_printSpecs.m_url.toString(), x, y + textHeight);
- }
-
- String pgInfo = "Page " + (pageIndex + 1) + " of " + this.m_props.m_printSpecs.m_nPages;
- g.drawString(pgInfo, x, y + height - textHeight);
- String date = this.m_props.m_printSpecs.m_date.toString();
- int space = width - fm.stringWidth(pgInfo);
- int dateWidth = fm.stringWidth(date);
- if (space > dateWidth + 2) {
- g.drawString(date, x + width - (dateWidth + 2), y + height - textHeight);
- }
-
- g.setFont(oldFont);
- }
-
- public void printPage() {
- this.printPage(true, true, true, true);
- }
-
- public void printPage(boolean bShowDialog, boolean bPrintFooterHeader, boolean bUnderLine, boolean bBackground) {
- if (!this.m_bPrinting && this.m_rootView != null) {
- double imageableWidth = (double)((int)this.m_props.m_pageFormat.getImageableWidth());
- double imageableHeight = (double)((int)this.m_props.m_pageFormat.getImageableHeight());
- this.layoutViews(this.m_props.m_printingLayoutWidth);
- int pageWidth = this.m_rootView.getBounds().width;
- double scaleFactor = imageableWidth / (double)pageWidth;
- int pageHeight = (int)(imageableHeight / scaleFactor);
- int nPages = this.paginate(pageWidth, pageHeight);
- this.m_props.m_printSpecs.m_bPrintFooterHeader = bPrintFooterHeader;
- this.m_props.m_printSpecs.m_nPerPage = 1;
- this.m_props.m_printSpecs.m_pageWidth = pageWidth;
- this.m_props.m_printSpecs.m_pageHeight = pageHeight;
- this.m_props.m_printSpecs.m_pageBreakHeight = this.m_layoutInfo.pageBreakHeight;
- this.m_props.m_printSpecs.m_nPages = nPages;
- this.m_props.m_printSpecs.m_pageFormat = this.m_props.m_pageFormat;
- this.m_props.m_printSpecs.m_date = new Date();
- this.m_props.m_printSpecs.m_url = this.m_props.m_loadedPage;
- this.m_props.m_printSpecs.bUnderLineLinks = bUnderLine;
- this.m_props.m_printSpecs.bDisplayBkgndImage = bBackground;
- this.m_props.m_printJob = PrinterJob.getPrinterJob();
- String name = "HTMLWindow";
- if (this.m_props.m_printSpecs.m_url != null) {
- name = name + " - " + this.m_props.m_printSpecs.m_url.toString();
- }
-
- this.m_props.m_printJob.setJobName(name);
- PageFormat pf = (PageFormat)this.m_props.m_pageFormat.clone();
- Paper pr = pf.getPaper();
- pr.setImageableArea(8.351999999999999, 8.351999999999999, 595.2959999999999, 744.0479999999999);
- pf.setPaper(pr);
- Book bk = new Book();
- bk.append(this, pf, this.m_props.m_printSpecs.m_nPages);
- this.m_props.m_printJob.setPageable(bk);
- boolean bPrint = true;
- if (bShowDialog) {
- bPrint = this.m_props.m_printJob.printDialog();
- }
-
- if (!bPrint) {
- this.m_layoutInfo.bPaginate = false;
- this.forceLayout();
- } else {
- try {
- this.m_props.m_printJob.print();
- } catch (Exception e) {
- System.out.println("exception: " + ((Throwable)e).getMessage());
- ((Throwable)e).printStackTrace();
- } finally {
- this.m_layoutInfo.bPaginate = false;
- this.forceLayout();
- }
-
- }
- }
- }
-
- private void printViewTree(View v, int index) {
- String indent = "";
-
- for(int i = 0; i < index; ++i) {
- indent = indent + ' ';
- }
-
- String name = v.getClass().getName();
- toLog(indent + name, 0);
- index += 2;
- int cnt = v.m_children.length;
-
- for(int i = 0; i < cnt; ++i) {
- this.printViewTree(v.m_children[i], index);
- }
-
- }
-
- protected void processKeyEvent(KeyEvent e) {
- if (this.m_rootView != null) {
- if (((AWTEvent)e).getID() == 401 && e.getKeyCode() == 9) {
- this.handleTabKey(e);
- } else if (((AWTEvent)e).getID() == 401 && e.getKeyCode() == 40) {
- this.scrollScreen(true);
- } else if (((AWTEvent)e).getID() == 401 && e.getKeyCode() == 38) {
- this.scrollScreen(false);
- } else if (((AWTEvent)e).getID() == 401 && e.getKeyCode() == 36 && (((InputEvent)e).getModifiers() & 2) != 0) {
- ((JComponent)this).scrollRectToVisible(new Rectangle(0, 0, 1, 1));
- } else if (((AWTEvent)e).getID() == 401 && e.getKeyCode() == 35 && (((InputEvent)e).getModifiers() & 2) != 0) {
- ((JComponent)this).scrollRectToVisible(new Rectangle(0, this.m_rootView.getBounds().y + this.m_rootView.getBounds().height - 1, 1, 1));
- } else if (((AWTEvent)e).getID() == 401 && e.getKeyCode() == 10) {
- if (this.m_props.m_focusElement != null && this.m_props.m_focusElement.isLink()) {
- URL u = Utilities.getURL(this.m_document.getBaseURL(), (String)this.m_props.m_focusElement.getAttribute("href"));
- if (u != null) {
- this.loadPage(u, true);
- }
- }
-
- ((InputEvent)e).consume();
- }
-
- }
- }
-
- protected void processMouseEvent(MouseEvent evt) {
- if (this.m_document != null && !this.m_bParsing) {
- super.processMouseEvent(evt);
- int x = evt.getX();
- int y = evt.getY();
- if (((AWTEvent)evt).getID() == 501) {
- ((JComponent)this).requestFocus();
- }
-
- if (evt.isPopupTrigger() && this.m_props.m_loadedPage != null) {
- if (this.notifyStatusListeners(8, this.m_props.m_loadedPage)) {
- this.m_props.m_popup.show(this, x, y);
- }
- } else if (((AWTEvent)evt).getID() == 501 && (((InputEvent)evt).getModifiers() & 16) > 0) {
- if (this.m_props.m_popup != null && this.m_props.m_popup.isShowing()) {
- this.m_props.m_popup.setVisible(false);
- }
-
- this.m_document.unSelectText();
- ModelInfo info = this.getModelInfo(x, y);
- if (info.m_ev != null && info.m_ev.m_elem != null) {
- this.m_document.m_selectedP0 = info.m_ev.m_elem.m_textbufferPosition;
- }
-
- this.clearFocusElement();
- if (info.url != null) {
- this.notifyMouseOverLink(info.url);
- this.m_props.m_focusElement = info.m_ev.m_elem;
- this.m_props.m_focusElement.propagateFocus(true);
- }
-
- ((Component)this).repaint();
- } else if (((AWTEvent)evt).getID() == 502 && (((InputEvent)evt).getModifiers() & 16) > 0) {
- ModelInfo info = this.getModelInfo(x, y);
- if (info.m_ev == null) {
- return;
- }
-
- this.imageMapHitTest(evt, info);
- if (info.url != null) {
- boolean bLoad = false;
- if (info.url != null) {
- bLoad = this.notifyMousePressedOverLink(info.url);
- }
-
- if (bLoad && this.m_props.m_bIsFrame && this.m_props.m_framesetView != null && info.target != null) {
- HTMLPane pane = this.m_props.m_framesetView.getFrame(info.target);
- if (pane != null) {
- pane.loadPage(info.url, false);
- ((Component)pane).repaint();
- return;
- }
-
- for(Container parent = ((Component)this).getParent(); parent != null; parent = ((Component)parent).getParent()) {
- if (parent instanceof HTMLPane) {
- ((HTMLPane)parent).loadPage(info.url, false);
- return;
- }
- }
- }
-
- if (bLoad) {
- this.loadPage(info.url, true);
- }
- } else if (info.m_ev.m_elem != null && info.m_ev.m_elem.m_textbufferPosition != -1) {
- this.m_document.m_selectedP1 = info.m_ev.m_elem.m_textbufferPosition;
- if (this.m_document.m_selectedP0 > this.m_document.m_selectedP1) {
- int temp = this.m_document.m_selectedP1;
- this.m_document.m_selectedP1 = this.m_document.m_selectedP0;
- this.m_document.m_selectedP0 = temp;
- }
-
- ((Component)this).repaint();
- }
-
- this.clearFocusElement();
- }
-
- }
- }
-
- protected void processMouseMotionEvent(MouseEvent evt) {
- if (!this.m_bParsing) {
- super.processMouseMotionEvent(evt);
- ModelInfo info = this.getModelInfo(evt.getX(), evt.getY());
- if (info != null && info.m_ev != null && info.m_ev.m_elem != null && info.m_ev.m_view != null) {
- this.imageMapHitTest(evt, info);
- boolean bDragging = ((AWTEvent)evt).getID() == 506 && (((InputEvent)evt).getModifiers() & 16) > 0;
- if (bDragging && this.m_document != null && info.m_ev.m_elem.m_textbufferPosition != -1) {
- if (this.m_document.m_selectedP0 == -1) {
- this.m_document.m_selectedP0 = info.m_ev.m_elem.m_textbufferPosition;
- } else {
- this.m_document.m_selectedP1 = info.m_ev.m_elem.m_textbufferPosition;
- }
-
- if (this.m_document.isTextSelected()) {
- ((Component)this).repaint();
- }
- }
-
- this.m_toolTip.hide();
- if (this.m_preferences.m_bShowToolTip) {
- String tipText = info.m_ev.m_view.getToolTipText();
- if (tipText != null && !Utilities.isBlankSpaces(tipText)) {
- Point p = ((Component)this).getLocationOnScreen();
- this.m_toolTip.text = tipText;
- this.m_toolTip.setLocation(p.x + evt.getX() + 15, p.y + evt.getY() + 15);
- this.m_toolTip.show();
- }
- }
-
- if (info.m_ev.m_view.isLink()) {
- if (info.url != null) {
- this.notifyMouseOverLink(info.url);
- }
-
- ((Component)this).setCursor(Cursor.getPredefinedCursor(12));
- } else if (info.m_ev.m_elem.getType() == 9) {
- ((Component)this).setCursor(Cursor.getPredefinedCursor(2));
- } else {
- ((Component)this).setCursor(Cursor.getPredefinedCursor(0));
- }
-
- }
- }
- }
-
- public void reLoadPage() {
- if (this.m_props.m_loadedPage != null) {
- this.loadPage(this.m_props.m_loadedPage, false);
- }
-
- }
-
- public void removeLinkListener(LinkListener l) {
- this.m_props.m_linkListeners.removeElement(l);
- }
-
- public void removePagination() {
- this.m_layoutInfo.bPaginate = false;
- this.forceLayout();
- }
-
- public void removeStatusListener(HTMLPaneStatusListener l) {
- this.m_props.m_statusListeners.removeElement(l);
- }
-
- void renderPage(Graphics g) {
- this.m_rootView.paint(g, g.getClipRect());
-
- try {
- ((JComponent)this).paintChildren(g);
- } catch (IllegalArgumentException var5) {
- System.out.println("IllegalArgumentException thrown by a Swing component");
- System.out.println("HTMLWindow Recovering...");
- }
-
- Enumeration e = this.m_props.m_floaters.elements();
-
- while(e.hasMoreElements()) {
- View v = (View)e.nextElement();
- Rectangle r = v.getBounds();
- if (r != null) {
- v.paint(g, r);
- }
- }
-
- }
-
- int renderToPrinter(Graphics g, PageFormat pf, int pageIndex) throws PrinterException {
- Graphics2D g2d = (Graphics2D)g;
- AffineTransform origTfm = g2d.getTransform();
- g.setClip((int)this.m_props.m_printSpecs.m_pageFormat.getImageableX(), (int)this.m_props.m_printSpecs.m_pageFormat.getImageableY(), (int)this.m_props.m_printSpecs.m_pageFormat.getImageableWidth(), (int)this.m_props.m_printSpecs.m_pageFormat.getImageableHeight());
- if (this.m_props.m_printSpecs.m_nPerPage == 1) {
- AffineTransform at = new AffineTransform(origTfm);
- double scaleFactorX = Math.min((double)1.0F, this.m_props.m_printSpecs.m_pageFormat.getImageableWidth() / (double)this.m_rootView.getBounds().width);
- double scaleFactorY = Math.min((double)1.0F, this.m_props.m_printSpecs.m_pageFormat.getImageableHeight() / (double)this.m_props.m_printSpecs.m_pageHeight);
- at.scale(scaleFactorX, scaleFactorY);
- g2d.setTransform(at);
- g2d.translate((double)((int)this.m_props.m_printSpecs.m_pageFormat.getImageableX()) / scaleFactorX, (double)((int)this.m_props.m_printSpecs.m_pageFormat.getImageableY()) / scaleFactorY);
- int yTranslation = (this.m_props.m_printSpecs.m_pageHeight + this.m_props.m_printSpecs.m_pageBreakHeight) * pageIndex;
- g2d.translate(0, -yTranslation);
- this.m_props.m_bUnderLineLinks = this.m_props.m_printSpecs.bUnderLineLinks;
- this.m_props.m_bDisplayBackgroundImage = this.m_props.m_printSpecs.bDisplayBkgndImage;
- this.m_rootView.paint(g2d, ((Graphics)g2d).getClipRect());
-
- try {
- ((JComponent)this).paintChildren(g2d);
- } catch (IllegalArgumentException var15) {
- System.out.println("IllegalArgumentException thrown by a Swing component");
- System.out.println("HTMLWindow Recovering...");
- }
-
- Enumeration e = this.m_props.m_floaters.elements();
-
- while(e.hasMoreElements()) {
- View v = (View)e.nextElement();
- Rectangle r = v.getBounds();
- if (r != null) {
- v.paint(g, r);
- }
- }
-
- this.m_props.m_bUnderLineLinks = true;
- this.m_props.m_bDisplayBackgroundImage = true;
- }
-
- g2d.setTransform(origTfm);
- ((Graphics)g2d).setClip((int)pf.getImageableX(), (int)pf.getImageableY(), (int)pf.getImageableWidth(), (int)pf.getImageableHeight());
- if (this.m_props.m_printSpecs.m_bPrintFooterHeader) {
- this.printHeaderFooter(g, pf, pageIndex);
- }
-
- return 0;
- }
-
- private void scrollScreen(boolean bUp) {
- HTMLWindow wnd;
- if (this.m_rootView != null && (wnd = this.getHTMLWindow()) != null) {
- JViewport vp = this.getViewport();
- if (vp != null) {
- Dimension dim = vp.getExtentSize();
- Point p = vp.getViewPosition();
- int endY = this.m_rootView.getBounds().y + this.m_rootView.getBounds().height;
- int increment = dim.height / 10;
- if (bUp && p.y + dim.height < endY) {
- int newY = p.y + increment;
- if (newY > endY) {
- newY = endY - dim.height;
- }
-
- wnd.scrollToYPosition(newY);
- } else if (!bUp && p.y > 0) {
- int newY = Math.max(0, p.y - increment);
- wnd.scrollToYPosition(newY);
- }
- }
- }
-
- }
-
- private void scrollToPosition(int pos) {
- for(Component parent = ((Component)this).getParent(); parent != null; parent = parent.getParent()) {
- if (parent instanceof HTMLWindow) {
- ((HTMLWindow)parent).scrollToPosition(pos);
- return;
- }
- }
-
- }
-
- private void scrollToVisible(int pos) {
- for(Component parent = ((Component)this).getParent(); parent != null; parent = parent.getParent()) {
- if (parent instanceof HTMLWindow) {
- ((HTMLWindow)parent).scrollToVisible(pos);
- return;
- }
- }
-
- }
-
- public void setAlwaysSizableFrames(boolean bSizable) {
- this.m_preferences.m_bAlwaysSizableFrames = bSizable;
- }
-
- private void setAnchorFocus(Element anchor) {
- this.clearFocusElement();
- if (anchor.getType() == 50) {
- this.m_props.m_focusElement = anchor;
- anchor.setDrawFocusBox(true);
- } else {
- Element[] relates = anchor.getRelatedElements();
- if (relates.length > 0) {
- this.m_props.m_focusElement = relates[0];
- this.m_props.m_focusElement.setDrawFocusBox(true);
- this.m_props.m_focusElement.propagateDrawFocusBox(true);
- }
- }
-
- ((Component)this).repaint();
- }
-
- public void setDefaultFont(Font f) {
- if (f != null) {
- this.m_props.m_defaultFont = f;
- }
-
- }
-
- public void setFramesEnabled(boolean bEnable) {
- this.m_preferences.m_bFramesEnabled = bEnable;
- }
-
- public void setIFramesEnabled(boolean bEnable) {
- this.m_preferences.m_bIFramesEnabled = bEnable;
- }
-
- protected void setMargins(int width, int height) {
- this.m_props.m_marginWidth = width;
- this.m_props.m_marginHeight = height;
- }
-
- public void setPageFormat(PageFormat pf) {
- if (pf != null) {
- this.m_props.m_pageFormat = pf;
- }
-
- }
-
- public void setPopupMenu(JPopupMenu menu) {
- if (this.m_props.m_popup != null) {
- ((Container)this).remove(this.m_props.m_popup);
- }
-
- this.m_props.m_popup = menu;
- ((Container)this).add(this.m_props.m_popup);
- }
-
- public void setPrintingLayoutWidth(int width) throws Exception {
- if (width > 500) {
- this.m_props.m_printingLayoutWidth = width;
- } else {
- throw new Exception("Minimum printing layout width is 500 pixels!");
- }
- }
-
- public void setProgressiveDisplay(boolean bProgressive) {
- this.m_preferences.m_bProgressiveDisplay = bProgressive;
- }
-
- public void setSize(Dimension d) {
- this.lock();
- if (this.m_rootView != null) {
- if (d.width != this.m_rootView.getBounds().width) {
- this.layoutViews(d.width);
- }
-
- super.setSize(this.m_rootView.getBounds().width, this.m_rootView.getBounds().height);
- this.unlock();
- } else {
- super.setSize(d);
- this.unlock();
- }
- }
-
- public void setViewFactory(ViewFactory factory) {
- this.m_viewFactory = factory;
- }
-
- public void stop() {
- if (this.m_parsingThread != null && this.m_parsingThread.isAlive()) {
- this.m_parsingThread.interrupt();
- this.m_parsingThread = null;
- }
-
- ((Component)this).setCursor(Cursor.getPredefinedCursor(0));
- this.notifyStatusListeners(9, this.m_props.m_loadedPage);
- }
-
- public synchronized void syncOpenPage(URL u) throws IOException {
- ((Component)this).setCursor(Cursor.getPredefinedCursor(3));
- this.m_toolTip.hide();
- URLConnection con = u.openConnection();
- String contentType = con.getContentType();
- if (this.notifyStatusListeners(6, contentType)) {
- this.beginParsing(con);
- if (this.m_document != null) {
- Element root = this.m_document.getRootElement();
- if (root != null) {
- this.createViews(root);
- this.m_props.m_loadedPage = this.m_document.getURL();
- this.notifyStatusListeners(5, this.m_props.m_loadedPage);
- ((JComponent)this).scrollRectToVisible(new Rectangle(0, 0, 1, 1));
- if (this.m_props.m_loadedPage != null) {
- String urlStr = this.m_props.m_loadedPage.toString();
- int idx = urlStr.indexOf("#");
- if (idx != -1) {
- Element elem = this.m_document.getAnchor(urlStr.substring(idx + 1));
- if (elem != null && elem.m_p0 >= 0) {
- this.scrollToPosition(elem.m_p0);
- }
- }
- }
-
- this.forceLayout();
- }
- }
- }
-
- ((Component)this).setCursor(Cursor.getPredefinedCursor(0));
- }
-
- public static void toLog(String str, int nIndent) {
- if (pwOut == null) {
- try {
- String dir = System.getProperty("user.dir");
- FileOutputStream fOut = new FileOutputStream(dir + "\\viewtree.log");
- pwOut = new PrintWriter(fOut);
- } catch (IOException e) {
- ((Throwable)e).printStackTrace();
- }
- }
-
- if (nIndent > 0) {
- indent += nIndent;
- }
-
- String identStr = "";
-
- for(int i = 0; i < indent; ++i) {
- identStr = identStr + " ";
- }
-
- pwOut.println(identStr + str);
- if (nIndent < 0) {
- indent += nIndent;
- }
-
- }
-
- public synchronized void unLoadPage() {
- ((Container)this).removeAll();
- this.m_document = null;
- this.m_rootView = null;
- this.m_props.m_floaters.removeAllElements();
- System.gc();
- ((Component)this).repaint();
- }
-
- void unlock() {
- this.m_busyflag.freeBusyFlag();
- }
-
- public Element viewToModel(int x, int y) {
- ElementViewInfo info = this.floaterHitTest(x, y);
- if (info != null) {
- return info.m_elem;
- } else {
- if (this.m_rootView != null) {
- info = this.m_rootView.viewToModel(x, y);
- if (info != null) {
- return info.m_elem;
- }
- }
-
- return null;
- }
- }
-
- // $FF: synthetic method
- static void access$0(HTMLPane $0, int $1) {
- $0.scrollToPosition($1);
- }
- }
-